package org.example.web;

import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.core.Ordered;
import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 *  登录过滤器:拦截登录请求, 如果登录成功, 则生成JWT令牌, 通过响应发送给浏览器
 */
public class LoginFilter implements GatewayFilter, Ordered {
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        // 读取响应结果
        ServerHttpResponse response = exchange.getResponse();
        // 读取响应对象的捕获器
//        BodyCaptureResponse captureResponse

        return null;
    }

    @Override
    public int getOrder() {
        return 0;
    }
}


